﻿@using Library
@model Ecommerce.Models.EditUserViewModel

@using (Ajax.BeginForm("EditUser", "Admin",
    new AjaxOptions
    {
        HttpMethod = "POST",
        AllowCache = false,
        UpdateTargetId = "formctnr",
        InsertionMode = InsertionMode.Replace,
        OnSuccess = "onSuccess"
    }, new { @id = "roleForm", @class = "form-horizontal" }))
{
    <div class="modal-body">
        @Html.AntiForgeryToken()
        @Html.HiddenFor(m => m.Id)
        <div class="form-group">
            <label class="col-sm-2 control-label">@NOWCulture.GetString("Email")</label>
            <div class="col-md-10">
                <div class="col-sm-10">
                    @Html.TextBoxFor(m => m.Email, new { @class = "form-control" })
                    @Html.ValidationMessageFor(m => m.Email, "", new { @class = "text-danger" })
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">@NOWCulture.GetString("Full name")</label>
            <div class="col-md-10">
                <div class="col-sm-10">
                    @Html.TextBoxFor(m => m.FullName, new { @class = "form-control" })
                    @Html.ValidationMessageFor(m => m.FullName, "", new { @class = "text-danger" })
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">@NOWCulture.GetString("Phone")</label>
            <div class="col-md-10">
                <div class="col-sm-10">
                    @Html.TextBoxFor(m => m.PhoneNumber, new { @class = "form-control" })
                    @Html.ValidationMessageFor(m => m.PhoneNumber, "", new { @class = "text-danger" })
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">@NOWCulture.GetString("Gender")</label>
            <div class="col-md-10">
                <div class="col-sm-10">
                    <label class="radio-inline">
                        @Html.RadioButtonFor(m => m.Gender, 1)
                        @NOWCulture.GetString("Man")
                    </label>
                    <label class="radio-inline">
                        @Html.RadioButtonFor(m => m.Gender, 0)
                        @NOWCulture.GetString("Woman")
                    </label>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">@NOWCulture.GetString("Birthday")</label>
            <div class="col-md-10">
                <div class="col-sm-5">
                    @Html.EditorFor(m => m.Birthday)
                    @Html.ValidationMessageFor(m => m.Birthday, "", new { @class = "text-danger" })
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">@NOWCulture.GetString("Positon in organization")</label>
            <div class="col-md-10">
                <div class="col-sm-10">
                    @Html.TextBoxFor(m => m.PositionInOrganization, new { @class = "form-control" })
                    @Html.ValidationMessageFor(m => m.PositionInOrganization, "", new { @class = "text-danger" })
                </div>
            </div>
        </div>
        @Html.ValidationSummary(true, "", new { @class = "bg-danger" })
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">@NOWCulture.GetString("Close")</button>
        <input type="submit" class="btn btn-primary" value="@NOWCulture.GetString("Save")">
    </div>
    @Styles.Render("~/Content/admin-edituser")
    <script>
        var _dateFormat = '@NOWCulture.CurrentCultureInfo.DateTimeFormat.ShortDatePattern';
    </script>
    var twoLetterISOLanguageName = NOWCulture.CurrentCultureInfo.TwoLetterISOLanguageName;
    if (twoLetterISOLanguageName != "en")
    {
        @Scripts.Render(
        "~/Scripts/moment.min.js",
        string.Format("~/Scripts/moment.locale.{0}.js", twoLetterISOLanguageName),
        "~/bundles/admin-edit-user");
    }
    else
    {
        @Scripts.Render(
          "~/Scripts/moment.min.js",
          "~/bundles/admin-edit-user");
    }
}

